<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>${key.charege_scheme_edit}</title>
<%@ include file="/commons/validation.jsp" %>

<script language="JavaScript" src="${ctx}/scripts/personal.js"></script>
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/public.js"></script>
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/move.js"></script>
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/ajaxException.js"></script>
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/common.js"></script>
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/div/common.js"></script>

<link href="${ctx}/styles/personal.css" rel="stylesheet" type="text/css"/>
<link href="${ctx}/styles/aux_window.css" rel="stylesheet" type="text/css">

<script type="text/javascript">
	var parentTable = null;
	var formSerialize = null;

	/**
	*  当鼠标放在那个表格上时,parentTable指向那个表格
	**/
	function mouseOverHandle(obj){
		if(typeof obj == "string" && obj == "rightTable"){
			parentTable = document.getElementById(obj);
		}
		else{
			parentTable = document.getElementById("leftTable");;
		}
		parentTable.isItemTable = true;
	}

	function mySubmit(){
		var flag = document.forms('preparePaySchemeForm').fireEvent("onSubmit");
		if(!flag)  return;

		if(!validateSelectedItem()){
			Alert("${key.charege_scheme_chargeItem_confirm}!");
			return;
		}
		setButtonUnable();
		var url = "${ctx}/charge_preparePaySchemeAction.do?method=edit";
		var param = getFormSerial();
		new Ajax.Request(url,
	                    {method: 'post', parameters: param, onComplete: function(result){
	                    		ajaxSubmitException(result.responseText);
	                    		findFrame("main").flushFrame(false);
	                    		windowClose();
	                    }}
	                    );

	}

	function _windowClose(){
		if(isAllowClose()) windowClose();
		else AskConfirmTwo("数据已修改,是否保存","PreparePaySchemeEditFrame","mySubmit","windowClose");
	}
/***********窗体控制部分*******/
	/**
	*设置按钮不可用
	*/
	function setButtonUnable(){
		${"btn1_22"}.disabled = true;
		$("btn1_32").disabled = true;
	}

	/**
	*设置按钮可用
	*/
	function setButtonAble(){
		${"btn1_22"}.disabled = false;
		$("btn1_32").disabled = false;
	}
/***********验证部分****************/
	/**
	*  判断是否可以提交
	**/
	function isAllowClose(){
		var secondFormSerialize = getFormSerial();
		return secondFormSerialize == formSerialize;
	}
	/**
	*验证是否选择了收费项目
	*/
	function validateSelectedItem(){
		var temp = move.getSelectedTableInfo();
		return temp == "" ? false : true;
	}
	function getFormSerial(){
		var temp = $('preparePaySchemeForm').serialize();
		temp += "&schDetail=" + move.getSelectedTableInfo();
		return temp;
	}
/***********end****************/
	function initSecond(){
		formSerialize = getFormSerial();
	}
	var move = null;
	function init(){
		move = new Move();
		move.processCompositor("rightTable");
	}
</script>
</head>

<body onload="init();initSecond();">
<form action="" id="preparePaySchemeForm" method="post" class="required-validate">
<input type="hidden" name="creator" value="${prePaySchVO.creator}">
<input type="hidden" id="prePaySchId" name="prePaySchId" value="${prePaySchVO.prePaySchId}">
<table  width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td colspan="2" class="window_head_outBg"><table border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="121"><img src="${ctx}/images/ico_Advance.gif" width="16" height="16" align="absmiddle"><span class="window_head_intext">修改方案</span></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td colspan="2" class="aux_header_line_1"></td>
  </tr>
  <tr>
    <td colspan="2" class="aux_header_line_2"></td>
  </tr>
  <tr>
    <td colspan="2" class="content"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td class="aux_outtable_color"><table width="100%" border="0" cellpadding="0" cellspacing="1" class="aux_intable_color">
            <tr>
              <td class="aux_intable_td1">${key.charege_scheme_name}：</td>
              <td class="aux_intable_require">
              	<table border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td ><input name="schemeName" value="${prePaySchVO.schemeName}" type="text" class="inputtext required validate-char validate-ajax" relativeId="prePaySchId" validateUrl="${ctx}/charge_preparePaySchemeAction.do?method=validateSchemeName" validateMessage="该预交方案已经存在,请重新输入!" maxlength="50" size="16"></td>
                    <td width="4">&nbsp;</td>
                    <td width="4">&nbsp;</td>
                    <td ><input type="checkbox"
                    			name="isDefault"
                    			value="1"
                    			${prePaySchVO.isDefault == 1 ? "checked onclick='return false'": ""}>
                    </td>
                    <td >${key.charege_scheme_default}</td>
                  </tr>
              </table></td>
            </tr>
            <tr>
              <td valign="top" class="aux_intable_td1"><span id="roomnum">${key.charege_scheme_remark}：</span></td>
              <td class="aux_intable_td2">
              <textarea name="remark" cols="20" rows="4" class="textareatext max-length-500">${prePaySchVO.remark}</textarea>
			  </td>
            </tr>
            <tr>
              <td colspan="2" valign="top" class="aux_titletable">${key.charege_scheme_chareItem}：</td>
              </tr>
            <tr>
              <td colspan="2" valign="top" class="aux_intable_td1">
              <table  width="100%" border="0" cellspacing="10" cellpadding="0">
      <tr>
        <td>
        <table width="100%" border="0" cellspacing="0" cellpadding="0" >
            <tr>
              <td class="outskirt_title">${key.charege_scheme_unSelectedChareItem}</td>
            </tr>
            <tr>
              <td align="center" valign="top" class="outskirt_content">
              	<div style="height:200px;overflow:auto;">
              	<table width="100%" border="0" cellspacing="0" cellpadding="0" class="inside_content">
                  <tr>
                    <td valign="top">

                      <table id="leftTable" width="100%" border="0" cellspacing="1" cellpadding="0" onmouseover="mouseOverHandle(this);">
                        <tr>
                          <td>
							<c:forEach items="${chargeItems}" var="chargeItem">
                              <table id="${chargeItem.keyword}" border="0" cellpadding="2" cellspacing="0" width="95%" class="dragTable">
                                <tr onClick="clickListTr_p(this);" onMouseOut="outListTr_p(this)">
                                  <td>${chargeItem.itemName}</td>
                                </tr>
                              </table>
							</c:forEach>
     					  </td>
                        </tr>
                      </table>
                    </td>
                  </tr>
              </table>
              </div>
              </td>
            </tr>
          </table>
          </td>
        <td width="8%" align="center" valign="middle"><table border="0" cellspacing="0" cellpadding="5">
          <tr>
            <td><table border="0" cellpadding="0" cellspacing="0" align="center">
                <tr>
                  <td class="buttonOffLeft" id="btn1_51"></td>
                  <td class="buttonOffMiddle" id="btn1_52" onclick="move.rightMove()" onblur="btn_change(5)" onMouseOver="btn_change_over(5)" onMouseOut="btn_change_out(5)"><img src="${ctx}/images/ico_desktopzj.gif" border="0" align="absmiddle"></td>
                  <td class="buttonOffRight" id="btn1_53"></td>
                </tr>
            </table></td>
          </tr>
          <tr>
            <td><table border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td class="buttonOffLeft" id="btn1_61"></td>
                  <td class="buttonOffMiddle" id="btn1_62" onclick="move.leftMove();" onblur="btn_change(6)" onMouseOver="btn_change_over(6)" onMouseOut="btn_change_out(6)"><a href="#" onFocus="this.blur()"><img src="${ctx}/images/ico_desktopyq.gif" border="0" align="absmiddle"></a></td>
                  <td class="buttonOffRight" id="btn1_63"></td>
                </tr>
            </table></td>
          </tr>
          <tr>
            <td><table border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td class="buttonOffLeft" id="btn1_71"></td>
                  <td class="buttonOffMiddle" id="btn1_72" onclick="move.previousMove();" onblur="btn_change(7)" onMouseOver="btn_change_over(7)" onMouseOut="btn_change_out(7)"><img src="${ctx}/images/ico_arrowup.gif" border="0" align="absmiddle"></td>
                  <td class="buttonOffRight" id="btn1_73"></td>
                </tr>
            </table></td>
          </tr>
          <tr>
            <td><table border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td class="buttonOffLeft" id="btn1_81"></td>
                  <td class="buttonOffMiddle" id="btn1_82" onclick="move.nextMove();" onblur="btn_change(8)" onMouseOver="btn_change_over(8)" onMouseOut="btn_change_out(8)"><img src="${ctx}/images/ico_arrowdown.gif" border="0" align="absmiddle"></td>
                  <td class="buttonOffRight" id="btn1_83"></td>
                </tr>
            </table></td>
          </tr>
        </table></td>
        <td width="49%"><table width="100%" border="0" cellspacing="0" cellpadding="0" >
            <tr>
              <td class="outskirt_title">${key.charege_scheme_selectedChareItem}</td>
            </tr>
            <tr>
              <td valign="top" class="outskirt_content"><table width="100%" border="0" cellspacing="0" cellpadding="0" onmouseover="mouseOverHandle('rightTable');">
                  <tr>
                    <td width="100%">
                    	<div style="height:200px;overflow:auto;">
	                    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="inside_content">
	                        <tr>
	                          <td width="65%" valign="top">
	                          	<table id="rightTable" width="100%"  border="0" cellspacing="3" cellpadding="0" >
	                              <tr>
	                                <td>
										<c:forEach items="${prePaySchVO.schDetails}" var="schDetailItem">
			                              <table id="${schDetailItem.chargeItemId}" border="0" cellpadding="2" cellspacing="0" width="95%" class="dragTable">
			                                <tr onClick="clickListTr_p(this);" onMouseOut="outListTr_p(this)">
			                                  <td>${schDetailItem.chargeItemName}</td>
			                                </tr>
			                              </table>
										</c:forEach>
	                                </td>
	                              </tr>
	                          	</table>
	                          </td>
	                        </tr>
	                    </table>
	                    </div>
                    </td>
                  </tr>
              </table></td>
            </tr>
        </table></td>
      </tr>
    </table></td>
              </tr>
        </table>
    </td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td align="left" class="window_footer">&nbsp;</td>
    <td class="window_footer"><table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_21"></td>
              <td class="buttonOffMiddle" id="btn1_22" onClick="mySubmit();" onMouseOver="btn_change_over(2)" onMouseOut="btn_change_out(2)" onblur="btn_change(2)"><img src="${ctx}/images/ico_ok.gif" alt="" width="14" height="14" border="0" align="absbottom">${key.save}</td>
              <td class="buttonOffRight" id="btn1_23"></td>
            </tr>
        </table></td>
        <td class="btn_between_space"></td>
        <td><table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_31"></td>
              <td class="buttonOffMiddle" id="btn1_32" onClick="_windowClose();" onMouseOver="btn_change_over(3)" onMouseOut="btn_change_out(3)" onblur="btn_change(3)"><img src="${ctx}/images/ico_cancel.gif" alt="" width="14" height="14" border="0" align="absbottom">${key.close}</td>
              <td class="buttonOffRight" id="btn1_33"></td>
            </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
</form>
</body>
</html>